/** Lachlan Hewson-Doherty (h201384171)
 *  Diploma of Digital and Interactive Games
 *  lachlan_doherty@live.com.au
 *  2013
 */

package cabbage.database.operations;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;

import cabbage.database.utilities.DatabaseConnection;




public class LocationOps {
	
	
	private DatabaseConnection db;
	
	
	
	
	public boolean checkLocationExists( int location_id) throws SQLException {
		
		
		db = new DatabaseConnection
								();

		Connection conn = db.getConnection
										();		
		
		PreparedStatement ps = conn.prepareStatement
							("SELECT * from location where location_id=?");

		ps.setInt
			(1, location_id);

		ResultSet rs = ps.executeQuery
					();

		if (rs.next()) {	

			conn.close();
			return true;

		}

		conn.close();		
		return false;
		
	}

}
